package com.yc.deadletter.controller;

import com.yc.deadletter.config.MqConfig;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {

    @Autowired
    private RabbitTemplate rabbitTemplate;


    @RequestMapping("/test/{msg}")
    public String addMsg(@PathVariable("msg") String msg){

        rabbitTemplate.convertAndSend(MqConfig.BUSINESS_EXCHANGE_NAME,"",msg);

        return "success";

    }
}
